home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 February / CHIPCD_02_2002.iso / Internet / Macromedia ColdFusion Server 5 / coldfusion-50-win-us.exe / data1.cab / Examples / CFDOCS / snippets / isstruct.cfm < prev    next >
Encoding:
Text File  |  2001-06-13  |  1.3 KB  |  32 lines

  1. <!--- This view-only example illustrates usage of IsStruct. --->
  2. <P>This file is similar to addemployee.cfm, which is called
  3. by StructNew, StructClear, and StructDelete. It is an 
  4. example of a custom tag used to add employees. Employee 
  5. information is passed through the employee structure (the 
  6. EMPINFO attribute). In UNIX, you must also add the Employee_ID.
  7. <!--- 
  8. <cfswitch expression="#ThisTag.ExecutionMode#">
  9.    <cfcase value="start">
  10.       <CFIF IsStruct(attributes.EMPINFO)>
  11.         <CFOUTPUT>Error. Invalid data.</cfoutput>
  12.           <CFEXIT METHOD="ExitTag">
  13.       <cfelse>
  14.          <CFQUERY NAME="AddEmployee" DATASOURCE="cfsnippets">
  15.           INSERT INTO Employees
  16.                (FirstName, LastName, Email, Phone, Department)
  17.             VALUES 
  18.               <CFOUTPUT>
  19.                 (
  20.                   æ#StructFind(attributes.EMPINFO, "firstname")#Æ ,
  21.                   æ#StructFind(attributes.EMPINFO, "lastname")#Æ ,
  22.                   æ#StructFind(attributes.EMPINFO, "email")#Æ ,
  23.                   æ#StructFind(attributes.EMPINFO, "phone")#Æ ,
  24.                   æ#StructFind(attributes.EMPINFO, "department")#Æ
  25.                  )
  26.               </cfoutput> 
  27.         </cfquery>
  28.       </cfif>
  29.       <CFOUTPUT><HR>Employee Add Complete</cfoutput>
  30.    </cfcase>
  31. </cfswitch> --->
  32.